package com.everyline.lib_common.net

import com.everyline.lib_common.BuildConfig
import com.everyline.lib_common.global.ConfigKeys
import com.everyline.lib_common.global.Configurator


/**
 * Created by on 2020/11/23.
 * 天天挂线
 *  746608431@qq.com
 *  描述:TODO
 */

class HttpRequestManger {
    companion object {
        /**
         * 如果是复杂的 需要请求多个接口的，或者多个异步请求等等，可以写在这里，普通简单的接口直接 apiService 调用
         */

        val instance: HttpRequestManger by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { HttpRequestManger() }

        //双重校验锁式-单例 封装NetApiService 方便直接快速调用简单的接口
        val apiService: ApiService by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            RetrofitClient.instance.getApi(ApiService::class.java, Configurator.instance.getConfiguration<String>(
                ConfigKeys.WEB_API_HOST))
        }
    }
}